local IsNull = require('Core.IsNull')

local UnityUtils = {}

function UnityUtils.GetComponent(objOrTrans, type)
    local comp = objOrTrans:GetComponent(type)
    if not IsNull(comp) then
        return comp
    end
    return nil
end

-- 携程方法，等待指定时间
function UnityUtils.WaitFormSecond(time, onWaited)
    local timer = 0
    while timer < time do
        timer = timer + CS.UnityEngine.Time.deltaTime
        coroutine.yield(nil)
    end

    onWaited()
end

return UnityUtils